package com.xbongbong.saas.enums.business;

import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.paas.enums.FieldTypeEnum;
import com.xbongbong.saas.enums.SelectProductEnum;
import com.xbongbong.saas.enums.XbbRefTypeEnum;
import com.xbongbong.saas.enums.base.ContractBaseEnum;
import lombok.Getter;

import java.util.Objects;

/**
 * @Author: wujian
 * @Description: 智能补货列表页排序
 * @Date: 上午11:08 2021/11/30
 * @Param:
 * @return:
 **/
@Getter
public enum SmartReplenishmentEnum {


    /**
     * 一键采购
     **/
    OPTION("option_1","enum.product.attrName.product_imgs",FieldTypeEnum.IMAGE.getType(),"productImgs", XbbRefTypeEnum.SMART_REPLENISHMENT.getCode(),1),
    /**
     * 产品图片
     **/
    PRODUCT_IMGS("file_1","enum.product.attrName.product_imgs",FieldTypeEnum.IMAGE.getType(),"productImgs", XbbRefTypeEnum.SMART_REPLENISHMENT.getCode(),2),
    /**
     * 产品名称
     **/
    PRODUCT_NAME("text_1","enum.selectProduct.attrName.product_name",FieldTypeEnum.TEXT.getType(),"productName",XbbRefTypeEnum.SMART_REPLENISHMENT.getCode(),3),
    /**
     * 产品编号
     **/
    PRODUCT_NO("serialNo","enum.selectProduct.attrName.product_no",FieldTypeEnum.TEXT.getType(),"productNo",XbbRefTypeEnum.SMART_REPLENISHMENT.getCode(),4),
    /**
     * 产品规格
     **/
    SPECIFICATION("text_5","enum.selectProduct.attrName.specification",FieldTypeEnum.TEXT.getType(),"specification",XbbRefTypeEnum.SMART_REPLENISHMENT.getCode(),5),
    /**
     * 产品单位
     **/
    UNIT("text_8","enum.waitOutstock.attrName.unit",FieldTypeEnum.COMBO.getType(),"unit",XbbRefTypeEnum.SMART_REPLENISHMENT.getCode(),6),
    /**
     * 供应商
     **/
    SUPPLIER("text_9", "enum.product.attrName.supplier", FieldTypeEnum.LINK_BUSINESS_MULTI.getType(),"supplier",XbbRefTypeEnum.SMART_REPLENISHMENT.getCode(),7),

    // 库存数量
    STOCK_NUM("num_12","enum.product.attrName.stock",FieldTypeEnum.NUM.getType(),"stockNum",XbbRefTypeEnum.SMART_REPLENISHMENT.getCode(),9),



    /**
     * 未出库数量
     **/
    WAIT_OUTSTOCK_NUM("waitOutstockNum","enum.waitOutstock.attrName.wait_outstock_num",FieldTypeEnum.NUM.getType(),"waitOutstockNum",XbbRefTypeEnum.SMART_REPLENISHMENT.getCode(),8),

    /**
     * 采购在途数量
     **/
    PENDING_INSTOCK_NUM("pendingInstockNum","",FieldTypeEnum.NUM.getType(),"pendingInstockNum",XbbRefTypeEnum.SMART_REPLENISHMENT.getCode(),10),

    /**
     * 最低库存
     **/
    MINI_NUM("miniNum","enum.smartReplenishment.attrName.mini_num",FieldTypeEnum.NUM.getType(),"miniNum",XbbRefTypeEnum.SMART_REPLENISHMENT.getCode(),11),
    /**
     * 建议采购数量
     **/
    ADVISE_PURCHASE_NUM("advisePurchaseNum","",FieldTypeEnum.NUM.getType(),"advisePurchaseNum",XbbRefTypeEnum.SMART_REPLENISHMENT.getCode(),12),
    ;

    private String attr;

    private String attrName;

    private Integer fieldType;

    private String saasAttr;

    private Integer linkedType;

    private Integer sort;

    SmartReplenishmentEnum(String attr, String attrName, Integer fieldType, String saasAttr, int linkedType, int sort) {
        this.attr = attr;
        this.attrName = attrName;
        this.fieldType = fieldType;
        this.saasAttr = saasAttr;
        this.linkedType = linkedType;
        this.sort = sort;
    }
    public static Integer getSortBySmartReplenishmentSort(String attr){
        for (SmartReplenishmentEnum waitOutstockEnum : SmartReplenishmentEnum.values()){
            if (Objects.equals(attr,waitOutstockEnum.getAttr())){
                return waitOutstockEnum.getSort();
            }
        }
        return 0 ;
    }



    public String getAttrName() {
        return I18nMessageUtil.getMessage(attrName);
    }



}
